home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 July / CHIP 2006-07.2.iso / program / web_gelistirme / easyphp1-7_setup.exe / {app} / phpmyadmin / db_details.php < prev    next >
Encoding:
PHP Script  |  2003-09-07  |  8.9 KB  |  197 lines

  1. <?php
  2. /* $Id: db_details.php,v 1.185 2003/08/05 17:12:47 nijel Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * Runs common work
  8.  */
  9. require('./db_details_common.php');
  10. $url_query .= '&goto=db_details.php';
  11.  
  12.  
  13. /**
  14.  * Database work
  15.  */
  16. if (isset($show_query) && $show_query == '1') {
  17.     // This script has been called by read_dump.php
  18.     if (isset($sql_query_cpy)) {
  19.         $query_to_display = $sql_query_cpy;
  20.     }
  21.     // Other cases
  22.     else {
  23.         $query_to_display = $sql_query;
  24.     }
  25. } else {
  26.     $query_to_display     = '';
  27. }
  28.  
  29.  
  30. /**
  31.  * Gets informations about the database and, if it is empty, move to the
  32.  * "db_details_structure.php" script where table can be created
  33.  */
  34. $sub_part    = '';
  35. require('./db_details_db_info.php');
  36. if ($num_tables == 0 && empty($db_query_force)) {
  37.     $is_info = TRUE;
  38.     include('./db_details_structure.php');
  39.     exit();
  40. }
  41.  
  42. // loic1: defines wether file upload is available or not
  43. // (now defined in common.lib.php)
  44.  
  45. $auto_sel  = ($cfg['TextareaAutoSelect']
  46.                // 2003-02-05 rabus: This causes big trouble with Opera 7 for
  47.                // Windows, so let's disable it there...
  48.                && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
  49.            ? "\n" . '             onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
  50.            : '';
  51. ?>
  52. <!-- Query box, sql file loader and bookmark support -->
  53. <a name="querybox"></a>
  54. <form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
  55.     onsubmit="return checkSqlQuery(this)">
  56.     <input type="hidden" name="is_js_confirmed" value="0" />
  57.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  58.     <input type="hidden" name="pos" value="0" />
  59.     <input type="hidden" name="goto" value="db_details.php" />
  60.     <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
  61.     <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>" />
  62.     <?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?> :<br />
  63.     <div style="margin-bottom: 5px">
  64. <textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
  65. <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
  66. </textarea><br />
  67.         <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /> 
  68.         <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
  69.     </div>
  70. <?php
  71. // loic1: displays import dump feature only if file upload available
  72. if ($is_upload) {
  73.     echo '    <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
  74.     ?>
  75.     <div style="margin-bottom: 5px">
  76.         <input type="file" name="sql_file" class="textfield" /><br />
  77.     <?php
  78.     $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
  79.     $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
  80.     if ($is_bzip || $is_gzip) {
  81.         echo '        ' . $strCompression . ':' . "\n"
  82.            . '            <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />' . "\n"
  83.            . '            <label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>   ' . "\n"
  84.            . '            <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />' . "\n"
  85.            . '            <label for="radio_sql_file_compression_plain">' . $strNone . '</label>   ' . "\n";
  86.         if ($is_gzip) {
  87.             echo '            <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
  88.                . '            <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>   ' . "\n";
  89.         }
  90.         if ($is_bzip) {
  91.             echo '            <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
  92.                . '            <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>   ' . "\n";
  93.         }
  94.     } else {
  95.         echo '        <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
  96.     }
  97.     ?>
  98.     </div>
  99.     <?php
  100. } // end if (is upload)
  101. echo "\n";
  102.  
  103. // web-server upload directory
  104.  
  105. $is_upload_dir = false;
  106. if ($cfg['UploadDir'] != '') {
  107.     if ($handle = @opendir($cfg['UploadDir'])) {
  108.         $is_first = 0;
  109.         while ($file = @readdir($handle)) {
  110.             if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
  111.                 if ($is_first == 0) {
  112.                     $is_upload_dir = true;
  113.                     echo "\n";
  114.                     echo '    <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
  115.                     echo '    <div style="margin-bottom: 5px">' . "\n";
  116.                     echo '        <select size="1" name="sql_localfile">' . "\n";
  117.                     echo '            <option value="" selected="selected"></option>' . "\n";
  118.                 } // end if (is_first)
  119.                 echo '            <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
  120.                 $is_first++;
  121.             } // end if (is_file)
  122.         } // end while
  123.         if ($is_first > 0) {
  124.             echo '        </select>' . "\n"
  125.                  . '    </div>' . "\n\n";
  126.         } // end if (isfirst > 0)
  127.         @closedir($handle);
  128.     }
  129.     else {
  130.         echo '    <div style="margin-bottom: 5px">' . "\n";
  131.         echo '        <font color="red">' . $strError . '</font><br />' . "\n";
  132.         echo '        ' . $strWebServerUploadDirectoryError . "\n";
  133.         echo '    </div>' . "\n";
  134.     }
  135. } // end if (web-server upload directory)
  136.  
  137. // Charset conversion options
  138. if ($is_upload || $is_upload_dir) {
  139.     if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
  140.         echo '    <div style="margin-bottom: 5px">' . "\n";
  141.         $temp_charset = reset($cfg['AvailableCharsets']);
  142.         echo $strCharsetOfFile . "\n"
  143.              . '    <select name="charset_of_file" size="1">' . "\n"
  144.              . '            <option value="' . $temp_charset . '"';
  145.         if ($temp_charset == $charset) {
  146.             echo ' selected="selected"';
  147.         }
  148.         echo '>' . $temp_charset . '</option>' . "\n";
  149.         while ($temp_charset = next($cfg['AvailableCharsets'])) {
  150.             echo '            <option value="' . $temp_charset . '"';
  151.             if ($temp_charset == $charset) {
  152.                 echo ' selected="selected"';
  153.             }
  154.             echo '>' . $temp_charset . '</option>' . "\n";
  155.         }
  156.         echo '        </select><br />' . "\n" . '    ';
  157.         echo '    </div>' . "\n";
  158.     } // end if (recoding)
  159. }
  160.  
  161. // Bookmark Support
  162. if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
  163.     if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
  164.         echo "    <i>$strOr</i> $strBookmarkQuery :<br />\n";
  165.         echo '    <div style="margin-bottom: 5px">' . "\n";
  166.         echo '        <select name="id_bookmark">' . "\n";
  167.         echo '            <option value=""></option>' . "\n";
  168.         while (list($key, $value) = each($bookmark_list)) {
  169.             echo '            <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($key) . '</option>' . "\n";
  170.         }
  171.         echo '        </select>' . "<br />\n";
  172.         echo '            ' . $strVar . ' (<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
  173.         echo '        <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
  174.         echo '         <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
  175.         echo '         <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
  176.         echo '        <br />' . "\n";
  177.         echo '    </div>' . "\n";
  178.     }
  179. }
  180.  
  181. // Encoding setting form appended by Y.Kawada
  182. if (function_exists('PMA_set_enc_form')) {
  183.     echo PMA_set_enc_form('    ');
  184. }
  185. ?>
  186.     <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
  187. </form>
  188.  
  189.  
  190. <?php
  191. /**
  192.  * Displays the footer
  193.  */
  194. echo "\n";
  195. require('./footer.inc.php');
  196. ?>
  197.